<template>
	<b-layout-index>
		<navbar bgcolor="#fff"></navbar>
		<view class=" mg-top-10 pd-left-10 pd-right-10">
			<base-panel-title :isRadius="true" :fill="true">
				<u-cell-group :border="false">
					<u-cell :value="userInfo.phone">
						<view slot="title" class="pd-left-5 pd-right-5">{{userInfo.nickName}}</view>
						<u-avatar randomBgColor slot="icon" :size="30" :src="userInfo.avatarUrl"></u-avatar>
					</u-cell>

					<u-cell icon="account" value="NNNNNN001">
						<view slot="title" class="pd-left-5 pd-right-5">我的授权编号</view>
					</u-cell>
					<u-cell icon="bookmark" :value="userInfo.agent.name" :border="false">
						<view slot="title" class="pd-left-5 pd-right-5">我的授权等级</view>
					</u-cell>


				</u-cell-group>
			</base-panel-title>

		</view>
		<view class="mg-top-10 pd-20">
			<u-button shape="circle" @click="createImage" type="primary">点击生成</u-button>
		</view>

		<posters-image  ref="images"></posters-image>

	</b-layout-index>
</template>

<script>
	//https://bpic.588ku.com/templet_pic/19/05/28/57c2f0ecec97431d2093f08752cc7268.jpg


	export default {
		data() {
			var userInfo = uni.getStorageSync('userInfo') || {
				avatarUrl: "",
				nickName: "",
				openId: ""
			};

			var authInfo = uni.getStorageSync("authInfo");
			const config = {
				clear: true,
				width: 595,
				height: 808,
				background: '#ffffff',
				views: [{
						type: 'image',
						width: 595,
						height: 808,
						top: 0,
						left: 0,
						// 封面图，测试的时候填上
						url: 'http://localhost/ams/static/upload/image/wechat/qrcode/invalid.jpg'
					},


					{
						type: 'text',
						width: 200,
						height: 50,
						left: 200,
						top: 220,
						fontSize: 30,
						lineHeight: 40,
						bolder: true,
						breakWord: true,
						content: authInfo.name,
						MaxLineNumber: 2,
						color: '#ffffff',
						algin: "center"
					},
					{
						type: 'text',
						width: 200,
						height: 50,
						left: 215,
						top: 718,
						fontSize: 16,
						lineHeight: 40,
						bolder: true,
						breakWord: true,
						content: 'XAHTAN00000',
						MaxLineNumber: 2,
						color: '#339966',
						algin: "center"
					},
					{
						type: 'text',
						width: 200,
						height: 50,
						left: 445,
						top: 718,
						fontSize: 16,
						lineHeight: 40,
						bolder: true,
						breakWord: true,
						content: userInfo.agent.name,
						MaxLineNumber: 2,
						color: '#339966',
						algin: "center"
					},

					{
						type: 'image',
						width: 250,
						height: 250,
						top: 298,
						left: 178,
						// 封面图，测试的时候填上
						url: 'http://localhost/ams/static/upload/image/wechat/qrcode/1664510110866serkol537375864.png'
					}

				]
			};
			return {
				authInfo: authInfo,
				userInfo: userInfo,
				postersData: config,
				posterImg: {},
				path:""


			};
		},

		onLoad() {

		},
		methods: {

			createImage: function() {
				var userInfo = this.userInfo
				var authInfo = this.authInfo

				this.$refs.images.start(this.postersData)
			}
			
			
		}
	}
</script>

<style>
</style>
